import {
  defineConfig,
  presetUno,
  presetIcons,
  presetAttributify,
  transformerDirectives,
} from 'unocss';
import presetRemToPx from '@unocss/preset-rem-to-px';
import transformerVariantGroup from '@unocss/transformer-variant-group';
import transformerAttributifyJsx from '@unocss/transformer-attributify-jsx';
import { presetScrollbar } from 'unocss-preset-scrollbar';

export default defineConfig({
  rules: [],
  shortcuts: [
    // flex
    ['flex-start', 'flex justify-start items-center'],
    ['flex-center', 'flex justify-center items-center'],
    ['flex-between', 'flex justify-between items-center'],
    ['flex-end', 'flex justify-end items-center'],
    // scrollbar
    [
      'scrollbar-preset',
      'scrollbar scrollbar-rounded scrollbar-thumb-color-#cbd5e1 dark:scrollbar-thumb-color-#5c6777 scrollbar-track-color-transparent',
    ],
    ['scrollbar-sm', 'scrollbar-preset scrollbar-w-4px '],
    ['scrollbar-md', 'scrollbar-preset scrollbar-w-6px'],
    ['scrollbar-lg', 'scrollbar-preset scrollbar-w-8px'],
  ],
  presets: [
    presetUno(),
    presetAttributify(),
    presetRemToPx(),
    presetIcons({
      warn: true,
      scale: 1.15,
      extraProperties: {
        display: 'inline-block',
        'vertical-align': '-0.23em',
      },
    }),
    presetScrollbar(),
  ],
  transformers: [transformerDirectives(), transformerVariantGroup(), transformerAttributifyJsx()],
});
